Component({
  relations: {
    './grid': {
      type: 'child'
    },
  },
  options: {
    multipleSlots: true
  },
  properties: {
    width: { //九宫格单格所占屏幕宽度比例
      type: [String, Number],
      value: '33.33'
    }
  },
  data: {
    grids: []
  },
  lifetimes: {
    ready() {
      this.initGrids()
    }
  },
  methods: {
    initGrids() {
      let items = this.getRelationNodes('./grid');
      if (items.length == 0) return;
      let grids = items.map((item, index) => {
        return {
          index: index
        };
      });
      this.setData({
        grids: grids
      });
    }
  }
})